<template>
  <div class="app-container">
    <!-- <div class="head-container">
      <el-button @click="toForm(null,'0')"
                 type="primary"
                 size="small"
                 icon="el-icon-plus">新增</el-button>
    </div> -->

    <el-table :data="roleData"
              border
              height="700"
              style="width:100%"
              v-loading="loading">
      <el-table-column label="id"
                       prop="id"
                       width="100"
                       align="center" />
      <el-table-column label="权限标识"
                       prop="permission"
                       align="center" />
      <el-table-column label="角色名称"
                       prop="name"
                       align="center" />
      <!-- <el-table-column label="操作"
                       align="center"
                       width="250">
        <template slot-scope="scope">
          <div>
            <el-button type="warning"
                       icon="el-icon-edit"
                       size="small"
                       @click="toForm(scope.row.id, '0')">编辑</el-button>
            <el-button type="danger"
                       icon="el-icon-delete"
                       size="small"
                       @click="handleDelete(scope.row.id)">删除</el-button>
          </div>
        </template>
      </el-table-column> -->
    </el-table>
  </div>
</template>


<script>
import { getAllRoles } from '@/api/auth'
export default {
  name: 'RoleMng',
  props: {
    activeName: {
      type: String,
      default: '1'
    },
  },
  data() {
    return {
      loading: false,
      roleData: []
    }
  },
  created() {
    this.loading = true
    getAllRoles({}).then(res => {
      if (res.publicData.retInfo.retCode === 0) {
        this.roleData = res.data.results
      }
      this.loading = false
    }).catch(e => {
      this.loading = false
    })
  },
  methods: {
    handleUpdate() { },
    handleDelete() { },
    toForm(id, isEdit) {
      this.$router.push({
        path: '/roleForm',
        query: {
          id: id,
          isEdit: isEdit,
          activeName: this.activeName
        }
      })
    }
  },
}
</script>

<style lang="scss" scoped>
</style>